<?php
/**
 * @author chinlone@163.com
 * @time 2016.01.03 14:00
 */

function writeLog($msg){
    date_default_timezone_set("Asia/Shanghai");
    file_put_contents('log.txt',"\r\n".date("h:i:sa").': '.$msg,FILE_APPEND|LOCK_EX);
}

$password = 'you_password';
$postData = json_decode($_POST['hook'],true);
if($postData['password'] != $password){
    writeLog('password = '.$postData['password'].' un-authorization request:'.$_SERVER['HTTP_HOST']);
    die;
}
exec('/opt/lampp/htdocs/githook.sh');


?>
